package com.xuecheng.search.controller;

import com.xuecheng.base.model.PageParams;
import com.xuecheng.search.dto.SearchCourseParamDTO;
import com.xuecheng.search.dto.SearchPageResultDTO;
import com.xuecheng.search.po.CourseIndex;
import com.xuecheng.search.service.ICourseSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author 勾新杰
 * @version 1.0
 * @description 课程搜索接口
 * @date 2025/11/30 21:09
 */
@Api(tags = "课程搜索接口")
@RestController
@RequestMapping("/course")
@RequiredArgsConstructor
public class CourseSearchController {

    /**
     * 课程搜索服务
     */
    private final ICourseSearchService courseSearchService;

    /**
     * 课程搜索列表
     *
     * @param pageParams          分页参数
     * @param searchCourseParamDTO 搜索条件
     * @return 课程搜索列表
     */
    @GetMapping("/list")
    @ApiOperation("课程搜索列表")
    public SearchPageResultDTO<CourseIndex> list(PageParams pageParams, SearchCourseParamDTO searchCourseParamDTO) {
        return courseSearchService.pageQueryCourseIndex(pageParams, searchCourseParamDTO);
    }
}
